﻿Imports System.Net.Mail
Imports System.Net
Public Class frmMail


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim client = New SmtpClient("smtp.gmail.com", 587)
        Dim message As New MailMessage("intermedia383@gmail.com", "intermedia.vishnu@gmail.com")
        client.EnableSsl = True
        Dim credential As New NetworkCredential("intermedia383@gmail.com", "f2d7h2s6g5")

        Dim attach As New Attachment("C:\123.txt")
        
        With message
            .Subject = "Test Subject"
            .Body = "Just a test body"
            .Attachments.Add(attach)
        End With
        client.Credentials = credential
        client.Send(message)
    End Sub
End Class